<?php 
if($_REQUEST['cat'] > 0)
{ $items = getBorders($_REQUEST['cat']); }
else
{ $items = getBorders(); }
?>
<div class="menu_top">
	<input type="hidden" name="action" value="new_item">
	<input type="submit" value="Add new border" class="buttons" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/new.gif'); border:1px solid #DDDDDD;" />&nbsp;&nbsp;
	Title:&nbsp;&nbsp;<input name="name" type="text" value="" maxlength="99">
	<input type="submit" value="Save" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/save.gif'); border:1px solid #DDDDDD; height:20px;" class="buttons">
    <input type="button" onmousedown="document.getElementById('load_css').value=6; submit();" value="Reload Borders Css" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/process.gif'); border:1px solid #DDDDDD; height:20px;" 
        class="buttons">
        <input type="hidden" id="load_css" name="load_css" value="0" />
</div>
<div class="menu_list">
<table id="menulist" class="item_list" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<th nowrap="nowrap">#&nbsp;ID&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Title&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Type&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Width&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Active&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Edit&nbsp;&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Delete&nbsp;&nbsp;&nbsp;</th>
		<th nowrap="nowrap" width="100%">Sample</th>
	</tr>
	<?php 
	if($items):
	foreach($items as $item)
	{
	?>
	<tr class="items">
		<td nowrap="nowrap">#&nbsp;<input type="hidden" name="brd_id[]" value="<?php echo $item['id']; ?>" /><?php echo $item['id']; ?></td>
		<td nowrap="nowrap"><input style="width:100px;" class="inp_txt" name="brd_name[]" type="text" value="<?php echo $item['name']; ?>" maxlength="90" /></td>
        <td nowrap="nowrap">
			<select name="brd_type[]"  onChange="submit();">
				<option value="0" <?php if($item['type'] == 0) { echo 'selected'; } ?>>CSS Wrapper</option>
                <option value="1" <?php if($item['type'] == 1) { echo 'selected'; } ?>>CSS-TB-LR-Image Border</option>
                <option value="2" <?php if($item['type'] == 2) { echo 'selected'; } ?>>CSS-RoundCorner-TL-TR-BL-BR Border</option>
                <option value="3" <?php if($item['type'] == 3) { echo 'selected'; } ?>>CSS-RoundCorner-TL-TC-TR-BL-BC-BR-ML-MC-MR</option>
			</select>
		</td>
		<td nowrap="nowrap">
			<select name="brd_width[]" style="width:64px;" onChange="submit();">
				<?php 
					$i=1;
					while($i <= 200)
					{
						if ($i == $item['width'])
						{
							echo '<option value="'.$i.'" selected="selected">'.$i.' px</option>';
						}
						else
						{
							echo '<option value="'.$i.'">'.$i.' px</option>';
						}
						$i ++;
					}
				?>
			</select>
		</td>
		<td nowrap="nowrap"><?php echo getActivationFields($item); ?></td>
		<td nowrap="nowrap">
			<a href="?con=<?php echo $_REQUEST['con']; ?>&item=<?php echo $item['id']; ?>"><img src="../images/system/templ.gif" border="0" /></a>&nbsp;
		</td>
		<td nowrap="nowrap"><input class="inp_image" type="image" name="delete_border" src="../images/system/trash_25.gif" value="0" onclick="this.value='<?php echo $item['id']; ?>'; edit_form.submit();" /></td>
		<td>
			<?php 
			echo getBorderHTML($item, 'top');  
			 ?><img src="../images/system/spacer.gif" /><?php
			echo getBorderHTML($item, 'bottom');
			?>
		</td>
	</tr>
	<?php
	}
	?>
</table>
<input type="hidden" id="activate" name="activate" value="0" />
<input type="hidden" id="deactivate" name="deactivate" value="0" />
</div>
<?php endif; ?>